package com.qf.admin.service.impl;

import com.qf.admin.domain.Echarts;
import com.qf.admin.domain.GoodEchart;
import com.qf.admin.domain.GoodsMoney;
import com.qf.admin.domain.newUserNum;
import com.qf.admin.mapper.EchartMapper;
import com.qf.admin.service.IEchartService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EchartServiceImpl implements IEchartService {

    private EchartMapper echartMapper;

    private EchartServiceImpl(EchartMapper echartMapper) {
        this.echartMapper = echartMapper;
    }

    @Override
    public List<Echarts> getAll() {
        List<Echarts> echarts = echartMapper.getAll();
        return echarts;
    }

    @Override
    public List<GoodsMoney> getSumMoney(int id) {
        //根据传入的id，查找对应分类下的所有相关商品订单，每次订单中各商品的单价和销售额
        List<GoodsMoney> sumMoney = echartMapper.getSumMoney(id);
        return sumMoney;
    }

    @Override
    public List<GoodEchart> getGoodIdAndNum(Integer limit) {
        return echartMapper.getGoodIdAndNum(limit);
    }

    @Override
    public String getGoodName(Integer goodId) {
        return echartMapper.getGoodName(goodId);
    }

    @Override
    public List<newUserNum> getNewUserNum(Integer day) {
        return echartMapper.getNewUserNum(day);
    }
}
